﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using RiskMan.DataClass.Models;
using RiskMan.DataClass.Models.Quik;
using RiskMan.DataClass.Models.RM;
using RiskMan.Properties;
using System.Windows.Documents;
using RiskMan.DataClass;

namespace RiskMan.Config
{
    public class History
    {
        private Data _data;

        public History ( DataClass.Data _dataProvider )
        {
            this._data = _dataProvider;
        }

        #region Загрузка

        public void Load ( )
        {
  

            _data.T2QItems.Clear( );
            var lis = GetQuikSettings();

            for ( int i = 0; i < lis.Count; i++ )
                _data.T2QItems.Add( lis[i] );

           
        }

       
        
        private ObservableCollection<QuikItem> GetQuikSettings ( )
        {
            return ( QuikItems ) XMLHistory.GetXmlData( XMLHistory.FILENAME_QUIKITEMS );
        }

      


        #endregion

        #region Сохранение

        public void Save ( )
        {
            SetQuikSettings( _data.T2QItems );

        }

     
        private void SetQuikSettings ( QuikItems quikItems )
        {
            XMLHistory.SetXmlData( XMLHistory.FILENAME_QUIKITEMS, ( Object ) quikItems );
        }

       

        #endregion
    }
}